<template>
    <view class="edit-name">
        <view class="input-box">
			<textarea type="text" auto-height placeholder-style="color:#999999"  placeholder="填写公告内容~" :value="inputText" @input="input" ></textarea>
		</view>
    </view>
</template>
<script>
export default {
    data() {
        return{
            inputText: '',
            gradeId: {}
        } 
    },
    onNavigationBarButtonTap(e){
        this.keep()
    },
    onLoad(options){
        this.gradeId = options.gradeId;
    },
    methods: {
		goBack(){
            uni.navigateBack({
				delta: 1
			})
		},
        keep(){
            // 保存
			let str = this.inputText.trim()
            if(!str){
				this.utils.showToast('群公告不能为空')
                return
            }
            this.api.post('chatGroupManage/addGradeNotice', {
                gradeId: this.gradeId,
                notice: this.inputText,
            }).then(res=>{
				if(res.data.state != 'ok') return;
				this.utils.showToast('发布成功')
            })
        },
        input(e){
            this.inputText = e.detail.value;
        }
    }
}
</script>
<style lang="less" scoped>
	.input-box{
		background-color: #ECECEC;
		margin: 40rpx 32rpx;
		padding: 24rpx 32rpx;
		box-sizing: border-box;
		border-radius: 20rpx;
		textarea{
			font-size: 28rpx;
			width: 100%;
			min-height: 292rpx;
		}
	}
</style>